﻿
using Qiniu.Storage;
using System;
using Qiniu.Util;
using qiniu_class;
using Qiniu.Http;

namespace Qiniu.Storage
{
    public class DownloadManagerEx: QiniuBase
    {
        public string CreatePrivateUrl(string pFileName)
        {
            Mac mac = new Mac(AccessKey, SecretKey);
            string domain = this.Domain;
            string key = pFileName;
            string privateUrl = DownloadManager.CreatePrivateUrl(mac, domain, key, 3600);
            return privateUrl;
        }

        public string CreatePublishUrl(string pFileName)
        {
            string domain = this.Domain;
            string key = pFileName;
            string publicUrl = DownloadManager.CreatePublishUrl(domain, key);
            Console.WriteLine(publicUrl);
            return publicUrl;
        }

        public  HttpResult Download(string url, string saveasFile)
        {
            return DownloadManager.Download(url, saveasFile);
        }
    }
}